package com.studynotes.dev.tech.config.properties;

import cn.hutool.core.text.CharSequenceUtil;
import com.studynotes.dev.tech.common.enums.CryptoModelEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.io.Serializable;
import java.nio.charset.StandardCharsets;

/**
 * @author Liu XiaoJun
 * @description: TODO
 * @date 2025-11-07 15:08:57
 */
@Data
@Accessors(chain = true)
@ConfigurationProperties(prefix = "study.notes.crypto-field")
public class CryptoFieldSettingProperties implements Serializable {
    private static final long serialVersionUID = 7415941004939555676L;

    private boolean enable = false;

    private String model = CryptoModelEnum.AES.name();

    private String key = "m40nsmCref1nyV02Eac59ab43c2be1eb";


    public byte[] getIv() {
        return CharSequenceUtil.padAfter(key, 16, "0").getBytes(StandardCharsets.UTF_8);
    }

}
